<?php

use tmcore\services\addons\middleware\Addon;

return [
    // 是否自动加载插件
    'autoload' => env('addons.autoload', false),
    // 是否强制路由
    'url_route_must' => true,
    // 是否路由文件固定
    'route_file_fixed' => true,
    // 支持应用模块
    'app_map'  => ['admin','api'],
    // 插件事件
    'events' => [],
    // 插件路由文件
    'routes' => [],
    // 插件中间件
    'middleware' => [
        Addon::class,
    ],
    // 终端执行命令
    'terminal_commands' => [
        'server' => [ // 服务端
            'dir' => 'server',
            'install' => 'composer install --no-interaction',
            'update' => 'composer update --no-interaction',
        ],
        'admin' => [ // 后台管理端
            'dir' => 'admin',
            'install' => 'npm install',
            'build' => 'npm run build',
        ],
        'uniapp' => [ // 手机端
            'dir' => 'uniapp',
            'install' => 'npm install',
            'build' => 'npm run build:h5',
        ],
        'pc' => [ // PC端
            'dir' => 'pc',
            'install' => 'npm install',
            'build' => 'npm run generate',
        ],
        'common' => [ // 通用命令
            'version' => [
                'dir' => '',
                'npm'  => 'npm -v',
                'node' => 'node -v',
                'php' => 'php -v',
            ],
            'npm_set_registry' => [
                'dir' => '',
                'npm'     => 'npm config set registry https://registry.npmjs.org/ && npm config get registry',
                'taobao'  => 'npm config set registry https://registry.npmmirror.com/ && npm config get registry',
                'tencent' => 'npm config set registry https://mirrors.cloud.tencent.com/npm/ && npm config get registry',
                'huawei'  => 'npm config set registry https://repo.huaweicloud.com/repository/npm/ && npm config get registry',
            ],
            'ping' => [
                'dir' => '',
                'baidu'     => 'ping baidu.com',
                'localhost' => 'ping 127.0.0.1',
            ]
        ],
        'test' => [ // 测试命令
            'dir'     => 'server/public/install/npm-test',
            'command' => 'npm install',
        ],
        'env' => [
            'path' =>  env('addons.env_path', ''),
            'composer_home' => env('addons.composer_home', '')
        ]
    ]
];